/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bionic.socialNet.entities;

import com.bionic.socialNet.dao.implementations.OraUser;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Ann
 */
public class LoginData {

    private String login;
    private String password;
    private int userType;

    /**
     * @return the login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @param login the login to set
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the userType
     */
    public int getUserType() {
        return userType;
    }

    /**
     * @param userType the userType to set
     */
    public void setUserType(int userType) {
        this.userType = userType;
    }

    public String getPassworgHash() {
        String passHash = null;
        try {
            MessageDigest m = MessageDigest.getInstance("MD5");
            m.update(getPassword().getBytes(), 0, getPassword().length());
            passHash = new BigInteger(1, m.digest()).toString(16);

        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(OraUser.class.getName()).log(Level.SEVERE, null,
                    ex);
            return null;
        }
        return passHash;
      
    }
}
